$INCLUDE: 'C:\FG\FASTGRAF.FI'

      PROGRAM MAIN

      INTEGER OLD_MODE
      INTEGER HIDDEN
      INTEGER X
      INTEGER FG_GETMODE, FG_TESTMODE

C  initialize the video environment

      CALL FG_INITPM
      IF (FG_TESTMODE(13,3) .EQ. 0) THEN
         STOP 'This program requires EGA.'
      END IF
      OLD_MODE = FG_GETMODE()
      CALL FG_SETMODE(13)

C  draw the background on page two

      CALL FG_SETPAGE(2)
      CALL FG_SETCOLOR(1)
      CALL FG_RECT(0,319,0,199)
      CALL FG_SETCOLOR(15)
      CALL FG_MOVE(160,100)
      CALL FG_ELLIPSE(20,20)

C  slide the object across the screen

      HIDDEN = 1
      CALL FG_SETCOLOR(10)
      DO 10 X = -10,318,4
         CALL FG_SETPAGE(HIDDEN)
         CALL FG_TRANSFER(0,319,0,199,0,199,2,HIDDEN)
         CALL FG_CLPRECT(X,X+19,96,105)
         CALL FG_SETVPAGE(HIDDEN)
         HIDDEN = 1 - HIDDEN
         CALL FG_WAITFOR(1)
10    CONTINUE

C  restore the original video mode and return to DOS

      CALL FG_SETMODE(OLD_MODE)
      CALL FG_RESET

      STOP ' '
      END
